package org.endy.leisure.diaTracker.repository

import org.endy.leisure.diaTracker.entity.announcement.AnnouncementView
import org.springframework.data.jpa.repository.JpaRepository
import org.springframework.data.repository.query.Param
import org.springframework.stereotype.Repository

@Repository
interface AnnouncementViewRepository : JpaRepository<AnnouncementView, Long> {

    /**
     * 根据UserId和AnnouncementId查询Announcement对象
     */
    fun findUserAnnouncementByUserIdAndAnnouncementId(
        @Param("userId") userId: Long,
        @Param("announcementId") announcementId: Long
    ): AnnouncementView?

    /**
     * 根据UserId和AnnouncementId查询Announcement对象
     */
    fun findAnnouncementViewByUserId(userId: Long): List<AnnouncementView>?

}